package java4_6.Homework4;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;

public class Client {
    public static void main(String[] args) {
        try {
            Socket s1 = new Socket("127.0.0.01",5253);
            //            输出开启
            PrintWriter pw1 = new PrintWriter(s1.getOutputStream(),true);
           //            输入开启
            BufferedReader br1 = new BufferedReader(new InputStreamReader(s1.getInputStream()));

            Scanner in = new Scanner(System.in);
            while (true){
                System.out.println(br1.readLine());//                 接收提示

                String str = in.nextLine();
                pw1.println(str);                 //                输出选择

                if (str.equals("5")){
                    break;
                }
                System.out.println(br1.readLine());
//                接收选择内容的反馈信息
            }
            s1.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
